home *** CD-ROM | disk | FTP | other *** search
/ Champak 103 / Vol 103.iso / games / starship.swf / scripts / DefineSprite_89 / frame_1 / DoAction.as
Text File  |  2010-03-13  |  774b  |  36 lines

  1. function init()
  2. {
  3.    var i = 1;
  4.    while(_root.cst.maxObjects >= i)
  5.    {
  6.       tellTarget("../object_" + i)
  7.       {
  8.          _root.temp.objectFrames = _totalframes;
  9.       }
  10.       if(Number(_root.temp.objectFrames) == 0)
  11.       {
  12.          _name = "object_" + i;
  13.          break;
  14.       }
  15.       i++;
  16.    }
  17.    gotoAndStop(1);
  18. }
  19. function hit()
  20. {
  21.    if(active == true)
  22.    {
  23.       _parent._parent._parent.ship.actEnergy += 70;
  24.       if(_parent._parent._parent.ship.maxEnergy < _parent._parent._parent.ship.actEnergy)
  25.       {
  26.          _parent._parent._parent.ship.actEnergy = _parent._parent._parent.ship.maxEnergy;
  27.       }
  28.       _parent._parent._parent.ship.refreshEnergy();
  29.       active = false;
  30.       play();
  31.    }
  32. }
  33. active = true;
  34. stop();
  35. init();
  36.